<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>事件绑定</title>
	<script src="lib/vue-2.1.3-min.js"></script>
	<script src="lib/lodash.min.js"></script>
</head>
<body>
	<div id="example-1">

		<button @click="counter += 1">Add Number</button>
		<p>{{counter}}</p>
	</div>
	<script>
		var vm = new Vue({
			el: "#example-1",
			data: {
				counter: 0
			}
		});
	</script>

	<div id="example-2">
		<h1>传递event</h1>
		<button v-on:click="sayhello">say hello</button>
		<p>{{message}}</p>
	</div>
	<script>
		var vm = new Vue({
			el: "#example-2",
			data: {
				message: null
			},
			methods: {
				sayhello: function(event) {
					this.message = "hello vue js 2.0, see console";
					console.log(event.target);
					console.log(event.target.tagName);
				}
			}
		});
	</script>

	<div id="example-3">
		<h1>传参，传递event</h1>
		<button v-on:click="sayWhat('vue is good',$event)">say hello</button>
	</div>
	<script>
		var vm = new Vue({
			el: "#example-3",

			methods: {
				sayWhat: function(msg, event) {
					alert(msg);
					alert(event.target.tagName);
				}
			}
		});
	</script>
</body>
</html>